#pragma once

#include "DAEFloat3.h"
#include <vector>

#include "VertexList.h"
#include "TriangleList.h"
#include "TRSTransform.h"
#include "SkeletonNode.h"
#include "AnimationTransform.h"

/**
* Describes a bone, with a start position and end position.
* @author Koen Samyn
*/ 
class Bone:public SkeletonNode
{
public:
	/**
	* Constructs a new Bone object with a start and endpoint.
	* @param start the start point of the bone.
	* @param end the end point of the bone.
	*/ 
	Bone(tstring Name,float length, int id );
	/**
	* Destroys the bone object.
	*/ 
	virtual ~Bone(void);
	/**
	* Returns the id for the bone.
	* @return the bone id.
	*/
	int GetID(){
		return m_ID;
	}

	/**
	* Sets the initial transform for this bone.
	* @param tx the x translation.
	* @param ty the y translation.
	* @param tz the z translation.
	* @param rx the rotation about the x axis
	* @param ry the rotation about the y axis.
	* @param rz the rotation about the z axis.
	* @param sx the x scale factor (default 1)
	* @param sy the y scale factor (default 1)
	* @param sz the z scale factor (default 1)
	*/
	void SetTransform( float tx, float ty, float tz, float rx, float ry, float rz, float sx=1.0f, float sy=1.0f,float sz=1.0f);
	/**
	* Creates a VertexBuffer and IndexBuffer from the
	* the start and end position of the bone.
	* and indexbuffer.
	*/
	void CreateBoneGeometry();
	/**
	* Draws the bone geometry if it exists.
	* @param material the material to use.
	*/
	//void Draw(Level* level, ShaderMaterial * material) const;

	/**
	* Animates this node, according to the 
	* provided time.
	* @param skeleton the skeleton this bone is part of. Bone matrices
	* will be set into the skeleton m_BoneMatrices member.
	* @param time the animation time (must be between start & stop interval)
	*/
	/*
	void Animate(Skeleton* skeleton,float time);
	*/
private:
	/**
	* The start of the bone.
	*/
	DAEFloat3 m_Start;
	/**
	* The end of the bone.
	*/
	DAEFloat3 m_End;
	/**
	* the id for the bone.
	*/
	int m_ID;
	/**
	* indicates if the bone geometry was created or not.
	*/ 
	bool m_HasGeometry;
	/**
	* The inverse bone matrix.
	*/
	DAEMatrix m_BoneInv;
	/**
	* The animation transform for this 
	* node.
	*/
	AnimationTransform m_AnimTransform;
	/**
	* The initial pose for this bone.
	*/
	TRSTransform m_InitialPose;

	// -------------------------
	// Disabling default copy constructor and default assignment operator.
	// If you get a linker error from one of these functions, your class is internally trying to use them. This is
	// an error in your class, these declarations are deliberately made without implementation because they should never be used.
	// -------------------------
	Bone(const Bone& t);
	Bone& operator=(const Bone& t);
};
